<?php
if (isset($_POST['upload'])) { 
	//var_dump($_FILES);
	
	if (($_FILES["upfile"]["type"] != "text/xml") || ($_FILES["upfile"]["size"] > 10485760)) { //10M=10*1024*1024
		echo "file not accepted!" . $_FILES["upfile"]["type"] . "only .xml file accepted.";
		return;
	}
	if ($_FILES["upfile"]["error"] > 0) {
		echo "Err: " . $_FILES["upfile"]["error"];
		return;
	}

	if (0 && file_exists("upload/" . $_FILES["upfile"]["name"])) {
		echo $_FILES["upfile"]["name"] . " already exists. ";
	} else {
		move_uploaded_file($_FILES['upfile']['tmp_name'], 'upload/' . $_FILES['upfile']['name']);
		echo "OK!";
	}
	//header('location: test.php');
	exit;
}
?>